﻿using System.Collections.Generic;

namespace KLTP2UI
{
	public class Filter
	{
		public Filter()
		{
			_typeFilter = new List<string>();
			_serviceFilter = new List<string>();
		}

		private readonly List<string> _typeFilter;
		private readonly List<string> _serviceFilter;

		public bool IsDefault
		{
			get { return _typeFilter.Count == 0 && _serviceFilter.Count == 0; }
		}
		public bool Enabled { get; set; }

		public List<string> Types { get { return _typeFilter; } }
		public List<string> Services { get { return _serviceFilter; } }

		public void MakeDefault()
		{
			_typeFilter.Clear();
			_serviceFilter.Clear();
		}
		public void RegisterToDllMem()
		{
			DllMem.FilterClear();
			if (Enabled)
			{
				_typeFilter.ForEach(DllMem.FilterAddType);
				_serviceFilter.ForEach(DllMem.FilterAddService);
			}
		}
	}
}
